#include <bits/stdc++.h>
using namespace std;

struct node{
    int v;
    bool flg;
    node *l, *r;
    node():v(0), flg(false), l(nullptr), r(nullptr){}
};

void del(node *p){
    if(!p) return;
    else{
        del(p->l);
        del(p->r);
        delete p;
    }
}
node *root;
bool error;

void add(string cmd){
    stringstream ss(cmd.substr(1, cmd.size()-2));
    int val; ss >> val;
    char ch; ss >> ch;
    string move; ss >> move;
    node *p = root;
    for (int j=0; j<move.size(); ++j) {
        if(move[j] == 'L'){
            if(!p->l) {
                node *left = new node;
                p->l = left;
            }
            p = p->l;
        }
        if(move[j] == 'R'){
            if(!p->r) {
                node *right = new node;
                p->r = right;
            }
            p = p->r;
        }
    }
    if(p->flg) {error = true; return;}
    p->v = val;
    p->flg = true;
}

bool read(){
    error = false;
    del(root);
    root = new node;
    string cmd;
    while(true){
        if(!(cin >> cmd)) return false;
        if(cmd == "()") return true;
        add(cmd);
    }
}

int main(){
    //ios_base::sync_with_stdio(false);cin.tie(nullptr);
    while(read()){
        queue<node*>q;
        q.push(root);
        vector<int> ans;
        while(!q.empty()){
            node *t = q.front(); q.pop();
            if(!t->flg) {error = true; break;}
            ans.push_back(t->v);

            if(t->l) q.push(t->l);
            if(t->r) q.push(t->r);
        }
        if(error) cout << "not complete\n";
        else{
            for (int i = 0; i < ans.size(); ++i) {
                if(!i) cout << ans[i];
                else cout << " " << ans[i];
            }
            cout << "\n";
        }
    }
    return 0;
}